package 函数式编程

object AbstractController {
  def main(args: Array[String]): Unit = {
    var s = "string"
    val tail = s.tail
    println(tail.head)
    println(tail.last)
    println(tail)

    s = demo1(s)
    print(s)

    /**
     * 字符串翻转案例
     */

    def demo1(s: String): String = {
      if (s.length == 1)
        s
      else {
        demo1(s.tail) + s.head
      }
    }
  }


}
